<template>
	<el-dialog :visible.sync="options.showDialog" width="600px" class="remarks">
		<h3 class="remarks-title">{{options.title}}</h3>
		<div class="remarks-content">
			<el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="textarea"></el-input>
			<el-button class="sub" size="small" style="width: 100px;" type="primary" @click="submit" v-show="options.title!='查看备注'">确定</el-button>
		</div>
	</el-dialog>
</template>

<script>
export default{
	props:{
		options:{
			require: true,
			type: Object
		}
	},
	data(){
		return {
			textarea: '',								//备注内容
		}
	},
	methods:{
		//提交数据
		submit(){
			if(!this.textarea){
				this.$message({
					message: '请输入备注内容！',
					type: 'warning'
				})
				return false;
			}
			this.$emit('subRemarks',this.textarea);
		},	
		clearData(){
			this.textarea = '';
		}
	},
	watch:{
		'options.showDialog'(){
			if(this.options.textarea){
				this.textarea=this.options.textarea
			}
			
		}
	}
}
</script>

<style scoped="scoped">
.remarks-title{height: 60px;line-height: 60px;text-align: center;font-size: 16px;}
.remarks-content{width: 500px;margin: 0 auto;padding-bottom: 20px;text-align: center;}
.remarks-content .sub{margin: 20px;}
</style>
